package com.rshy.cloud.bamboo.comm.basic.spring.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import com.netflix.loadbalancer.IRule;
import com.rshy.cloud.bamboo.comm.basic.spring.ribbon.IRoundRobinRule;

@Configuration
public class IBasicConfiguration extends FeignClientOkHttpConfiguration {

	/**
	 * 启动负载均衡
	 * @return
	 */
	@Bean
	@LoadBalanced
	RestTemplate restTemplate() {
		return new RestTemplate();
	}

	/**
	 * 自定义负载均衡策略
	 * @return
	 */
	@Bean
	public IRule myRule() {
		return new IRoundRobinRule();
	}
}
